package com.findyou.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;

/**
 * @Title: ServiceJavaConfig
 * @Author 贾金博
 * @Package com.findyou.config
 * @description: 业务层配置类： service aop tx
 *
 * service
 * 开启aop注解的支持   @Before @After @AfterReturning @AfterThrowing
 * tx声明事务管理 1:对应的事物管理器实现 2 开启事物注解的支持 @Transactional
 */
@Configuration // 配置类
@EnableAspectJAutoProxy
@EnableTransactionManagement // 开启事物注解
public class ServiceJavaConfig {

//    @Bean
    public TransactionManager transactionManager(DataSource dataSource) {
        DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
        //dataSourceTransactionManager.setDataSource();
        return null;
    }
}
